<style lang="less" scoped>
.main_user{
    position:relative;
    width: 100%;
    height: 1vw;
    .header_name{
        position: absolute;
        font-size: 0.8vw;
        right: 5vw;
    }
    .tuichu_login{
        font-size: 0.8vw;
        margin-left: 2vw;
        cursor:pointer;
    }
    .xiugai_password{
        font-size: 0.8vw;
        margin-left: 2vw;
        cursor:pointer;
        color: green;
    }
    .tuichu_login:hover{ color: red;}
    .xiugai_password:hover{ color: red;}
}
</style>
<template>
    <div class="main_user">
        <div class="header_name">欢迎回来，{{name}}!<a class="xiugai_password" @click="xiugaipassword">修改密码</a><a class="tuichu_login" @click="tuichu_login">退出登录</a></div>
    </div>
</template>
<script>
import { memberdetail } from '@/request/api';
export default {
  data() {
    return {
        name:'陈永刚'
    }
  },
  mounted() {
      this.getmemberdetail();
  },
  methods: {
    tuichu_login(){
        localStorage.setItem('token', "");
        this.$router.push({ name: 'jlb_login' });
        // let routeUrl = this.$router.resolve({
        //     path: 'jlb_login',
        // });
        // window.plsh(routeUrl.href, '_blank');
    },
    getmemberdetail(){
        memberdetail({}).then(res => {
            if(res.ok){
                this.name = res.data.name;
            }
          })
    },
    xiugaipassword(){
        let routeUrl = this.$router.resolve({
            path: 'jlb_detailpassword',
        });
        window.open(routeUrl.href, '_blank');
    }
    
  },
  components: {
        
  },

}
</script>
